<div class="page">
    <h2 class="title-historico">Meus Dados Cadastrais</h2>
    <hr/>
    <?php
    add_js('plugins/frontend/jquery.mask', 'footer', 8);
    add_js('scripts/frontend/form_pessoa_fisica', 'footer', 10);
    ?>

    <div class="row">

        <div class="col-xs-12">
            <div class="box-pessoa-fisica">

                <?php
                if ($erros = validation_errors()) {
                    echo '<div class="display-box-message alert alert-danger">' . $erros . '</div>';
                }

                if ($success = $this->session->flashdata('success_change')) {
                    echo '<div class="display-box-message alert alert-success">' . $success . '</div>';
                }
                ?>
                <?php
                echo form_open(BASE_URL_USER . '/save/' . $user->USER_ID, 'id="formPessoaFisica"');
                echo form_hidden('tipo', 'F');
                ?>
                <div class="box-form-cadastro">

                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Nome :', 'nome', array('class' => 'required')); ?>
                            </div>
                            <div class="col-xs-9">
                                <?php echo form_input('nome', set_value('nome', $user->NOME), 'class="form-control" validation="required"'); ?>
                            </div>
                        </div> 
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Cpf :', 'cpf', array('class' => 'required')); ?>	
                            </div>
                            <div class="col-xs-4">
                                <?php echo form_input('cpf', set_value('cpf', formate_cpf($user->CPF_CNPJ)), 'class="form-control" validation="required|cpf"'); ?>
                            </div>

                            <div class="col-xs-1">
                                <?php echo form_label('Rg :', 'cpf', array('class' => 'required')); ?>	
                            </div>
                            <div class="col-xs-4">

                                <?php echo form_input('rg', set_value('rg', $user->RG_IE), 'class="form-control" validation="required"'); ?>
                            </div>

                        </div> 
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Data Nascimento :', 'nascimento', array('class' => 'required')); ?>
                            </div>
                            <div class="col-xs-4">
                                <?php echo form_input('nascimento', set_value('nascimento', auto_format_data($user->NASCIMENTO, '-', '/')), 'class="form-control" validation="required"'); ?>
                            </div>
                            <div class="col-xs-1">
                                <?php echo form_label('CNH :'); ?>
                            </div>
                            <div class="col-xs-4">
                                <?php echo form_input('cnh', set_value('cnh', $user->CNH), 'class="form-control"'); ?>
                            </div>
                        </div> 
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Nacionalidade :'); ?>
                            </div>
                            <div class="col-xs-4">
                                <?php echo form_input('nacionalidade', set_value('nacionalidade', $user->NACIONALIDADE), 'class="form-control"'); ?>
                            </div>

                            <div class="col-xs-1">
                                <?php echo form_label('Sexo :'); ?>
                            </div>
                            <div class="col-xs-2">
                                <?php echo form_dropdown('sexo', array('M' => 'Masculino', 'F' => 'Feminino'), set_value('sexo', $user->SEXO), ' class="form-control select-sexo"'); ?>
                            </div>
                        </div> 
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Endereço :', 'endereco', array('class' => 'required')); ?>
                            </div>
                            <div class="col-xs-6">
                                <?php echo form_input('endereco', set_value('endereco', $user->LOGRADOURO), 'class="form-control" validation="required"'); ?>
                            </div>
                            <div class="col-xs-1">
                                <?php echo form_label('N. :', 'numero', array('class' => 'required')); ?>
                            </div>
                            <div class="col-xs-2">
                                <?php echo form_input('numero', set_value('numero', $user->NUMERO), 'class="form-control" validation="required"'); ?>
                            </div>
                        </div> 
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Cidade :', 'cidade', array('class' => 'required')); ?>
                            </div>
                            <div class="col-xs-6">
                                <?php echo form_input('cidade', set_value('cidade', $user->CIDADE), 'class="form-control" validation="required"'); ?>
                            </div>
                            <div class="col-xs-1">
                                <?php echo form_label('Estado:', 'estado', array('class' => 'required')); ?>
                            </div>
                            <div class="col-xs-2">
                                <?php echo form_input('uf', set_value('uf', $user->UF), 'class="form-control" validation="required"'); ?>
                            </div>
                        </div> 
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <label>Telefone : </label> 	
                            </div>
                            <div class="col-xs-1">
                                <?php echo form_input('telefone-ddd', set_value('telefone-ddd', substr($user->TELEFONE, 0, 2)), 'class="form-control" '); ?>

                            </div>
                            <div class="col-xs-3">
                                <?php echo form_input('telefone-numero', set_value('telefone-numero', substr($user->TELEFONE, 2)), 'class="form-control" '); ?>

                            </div>

                            <div class="col-xs-1">
                                <?php echo form_label('Celular:', 'celular', array('class' => 'required')); ?>		
                            </div>
                            <div class="col-xs-1">
                                <?php echo form_input('celular-ddd', set_value('celular-ddd', substr($user->CELULAR, 0, 2)), 'class="form-control" validation="required"'); ?>

                            </div>
                            <div class="col-xs-3">
                                <?php echo form_input('celular-numero', set_value('celular-numero', substr($user->CELULAR, 2)), 'class="form-control" validation="required"'); ?>

                            </div>

                        </div> 
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Email:', 'email', array('class' => 'required')); ?>	
                            </div>
                            <div class="col-xs-9">
                                <?php echo form_input('email', set_value('email', $user->EMAIL), 'class="form-control" validation="required|email"'); ?>	
                            </div>
                        </div> 
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Email Alternativo:', 'email-alternativo', array('class' => 'required')); ?>	
                            </div>
                            <div class="col-xs-9">
                                <?php echo form_input('email-alternativo', set_value('email-alternativo', $user->EMAIL_ALTERNATIVO), 'class="form-control" validation="required|email"'); ?>	
                            </div>
                        </div> 
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Nome da mãe:', 'nome-mae', array('class' => 'required')); ?>	
                            </div>
                            <div class="col-xs-9">
                                <?php echo form_input('nome-mae', set_value('nome-mae', $user->NOME_MAE), 'class="form-control" validation="required"'); ?>	
                            </div>
                        </div> 
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <div class="col-xs-2">
                                <?php echo form_label('Apelido:', 'apelido', array('class' => 'required')); ?>	
                            </div>
                            <div class="col-xs-3">
                                <?php echo form_input('login', set_value('login', $user->LOGIN), 'class="form-control" maxlength="12" readonly validation="required"'); ?>	
                            </div>
                            <div class="col-xs-2" style="text-align: right;">
                                <?php echo form_label('Estado Civil:', 'estado-civil', array('class' => 'required')); ?>	
                            </div>

                            <div class="col-xs-2">
                                <?php echo form_dropdown('estado_civil', array('CASADO' => 'Casado(a)', 'SOLTEIRO' => 'Solteiro(a)', 'SEPARADO' => 'Separado(a)', 'VIUVO' => 'Viuvo(a)'), set_value('estado_civil', $user->ESTADO_CIVIL), 'class="form-control select-sexo"'); ?>


                            </div>
                        </div> 
                    </div>


                    <a href="#altPassword" role="passwordChange" class="btn btn-sm btn-password-alter">Alterar Senha</a><br/>
                    <hr/>
                    <div class="row">
                        <div class="form-group box-display-input-passwords">

                        </div>
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <?php
                            echo form_submit('', 'Salvar Alterações', 'class="btn btn-primary pull-right"');
                            ?>
                        </div>
                    </div>

                </div>

                <div class="clear"></div>
                </form>
            </div>


        </div>

    </div>
</div>

